<?php
	session_start();
	if ( isset( $_SESSION['auth'] ) )
	{
		if (!isset($_GET['action'])) exit("No valid action");
		if ($_GET['action'] == "kick" )
		{
			$fp = @fsockopen( $_SESSION['ip'], $_SESSION['rport'], $errno, $errstr, 5);
			if ( !$fp ) exit( "OFF" );
			fwrite( $fp, $_SESSION['auth']." KICK ".$_GET['plr']." ".urldecode($_GET['reason']) );
			fclose( $fp );
		}
		elseif ($_GET['action'] == "ban" )
		{
			$fp = @fsockopen( $_SESSION['ip'], $_SESSION['rport'], $errno, $errstr, 5);
			if ( !$fp ) exit( "OFF" );
			fwrite( $fp, $_SESSION['auth']." BAN ".$_GET['plr']." ".urldecode($_GET['reason']) );
			fclose( $fp );
		}
		elseif ($_GET['action'] == "unban" )
		{
			$fp = @fsockopen( $_SESSION['ip'], $_SESSION['rport'], $errno, $errstr, 5);
			if ( !$fp ) exit( "OFF" );
			fwrite( $fp, $_SESSION['auth']." UNBAN ".urldecode($_GET['ip']) );
			fclose( $fp );
		}
	}
?>